package com.lyc.day1101.demo4;

/**
 * @author ：Xiaochen
 * @date ：Created in 2022/11/1 19:26
 * @description：
 * @modified By：
 * @version:
 */
public class TestDaemon {
    public static void main(String[] args) {
        DaemonDemo t1 = new DaemonDemo();
        t1.setDaemon(true);
        t1.start();

        for (int i = 0; i < 10; i++) {
            System.out.println("main----------------"+i);
        }
    }
}

class DaemonDemo extends Thread{
    @Override
    public void run() {
        for (int i = 0; i < 20; i++) {
            try {
                Thread.sleep(200);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(Thread.currentThread().getName()+"--------"+i);
        }
    }
}